Ext.onReady(function(){
	Ext.QuickTips.init();
	Ext.form.Field.prototype.msgTarget = 'side';
	//定义查询框
	var formPanel = new Ext.form.FormPanel({
		region: 'north',
		renderTo :document.body,
		labelWidth: 75, // label settings here cascade unless overridden
		frame: true,
		border: false,
		//height: 100,
		title: '代码生成',
		labelAlign: 'right',
		buttonAlign: 'left',
		defaults: {
			width: 230
		},
		defaultType: 'textfield',
		items: [{
			fieldLabel: '包名',
			name: 'pkgName',
			id: 'pkgName'
		},{
			fieldLabel:'类名',
			name:'className',
			id:'className'
		}],
		buttons: [{
			text: '生成',
			iconCls: 'query',
			handler: function(){
				Ext.Ajax.request({
					url:"codegen!codeGenerate.action",
					params:{
						pkgName:Ext.getCmp("pkgName").getValue(),
						className:Ext.getCmp("className").getValue()
					      },
					success:function(data){
					var jsonVal = Ext.decode(data.responseText);
					var val = jsonVal.result;
					if(val == 'true'){
						Ext.Msg.alert('提示',"生成成功!",function(){
							formPanel.getForm().reset();
							addWin.hide();
							search();
						});
					}else{
						Ext.Msg.alert('提示',"生成失败!",function(){
							formPanel.getForm().reset();
						});
					}
				}
				});
			}
			
		}, {
			text: '重置',
			iconCls: 'reset',
			handler: function(){
				formPanel.getForm().reset();
			}
			
		}]
	});
	
});
